<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>HTTP 响应头</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="reserved.variables.phperrormsg.html">« $php_errormsg</a></li>
      <li style="float: right;"><a href="reserved.variables.argc.html">$argc »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="reserved.variables.html">预定义变量</a></li>
    <li>HTTP 响应头</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="reserved.variables.httpresponseheader" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">$http_response_header</h1>
  <p class="refpurpose"><span class="refname">$http_response_header</span> &mdash; <span class="dc-title">HTTP 响应头</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-reserved.variables.httpresponseheader-description">
  <h3 class="title">说明</h3>
  <p class="para">
   <var class="varname">$http_response_header</var> <span class="type"><span class="type 数组">数组</span></span>与 <span class="function"><a href="function.get-headers.html" class="function">get_headers()</a></span> 函数类似。当使用<a href="wrappers.http.html" class="link">HTTP 包装器</a>时，<var class="varname">$http_response_header</var> 将会被 HTTP 响应头信息填充。<var class="varname">$http_response_header</var> 将被创建于<a href="language.variables.scope.html" class="link">局部作用域</a>中。
  </p>
 </div>

 
 <div class="refsect1 examples" id="refsect1-reserved.variables.httpresponseheader-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="variable.httpresponseheader.basic">
    <p><strong>示例 #1 <var class="varname">$http_response_header</var> 范例</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">get_contents</span><span style="color: #007700">()&nbsp;{<br />&nbsp;&nbsp;</span><span style="color: #0000BB">file_get_contents</span><span style="color: #007700">(</span><span style="color: #DD0000">"http://example.com"</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$http_response_header</span><span style="color: #007700">);<br />}<br /></span><span style="color: #0000BB">get_contents</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$http_response_header</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程的输出类似于：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
array(9) {
  [0]=&gt;
  string(15) &quot;HTTP/1.1 200 OK&quot;
  [1]=&gt;
  string(35) &quot;Date: Sat, 12 Apr 2008 17:30:38 GMT&quot;
  [2]=&gt;
  string(29) &quot;Server: Apache/2.2.3 (CentOS)&quot;
  [3]=&gt;
  string(44) &quot;Last-Modified: Tue, 15 Nov 2005 13:24:10 GMT&quot;
  [4]=&gt;
  string(27) &quot;ETag: &quot;280100-1b6-80bfd280&quot;&quot;
  [5]=&gt;
  string(20) &quot;Accept-Ranges: bytes&quot;
  [6]=&gt;
  string(19) &quot;Content-Length: 438&quot;
  [7]=&gt;
  string(17) &quot;Connection: close&quot;
  [8]=&gt;
  string(38) &quot;Content-Type: text/html; charset=UTF-8&quot;
}
NULL
</pre></div>
    </div>
   </div>
  </p>
 </div>

 
</div></div></div></body></html>